import React, {Component , Fragment} from 'react';
import {getRouterTemplate, getRouterMenu} from '../router/router';
import { Switch } from 'antd';
import Admin from "./InterfaceStyle/Admin";
import Gateway from "./InterfaceStyle/Gateway";
import style from './style/style.less';

export default class BasicLayout extends Component {
  state = { version:0 }
  onChange = () => {
    const { version } = this.state;
    this.setState({
      version: version===0?1:0
    })
  }
  render () {
    const routers = getRouterTemplate();
    const menuList = getRouterMenu();
    const { version } = this.state;
    const { onChange } = this;

    return (
      <Fragment>
        <div className={style.switchVersion}>
        <Switch defaultChecked onChange={onChange} />管理系统</div>
        {
          version ===0 ? <Admin routers={routers} menuList={menuList}/>:<Gateway routers={routers} menuList={menuList}/>
        }
      </Fragment>
    );
  }
}